import request from '@/utils/request'

/**
 * 查询教材列表
 * @param query
 * @returns {*}
 */
export function findList(query) {
  return request({
    url: '/knowledge/books',
    method: 'get',
    params: query
  })
}

/**
 * 查询教材详情
 * @param id
 * @returns {*}
 */
export function get(id) {
  return request({
    url: '/knowledge/books/' + id,
    method: 'get'
  })
}

/**
 * 新增教材
 * @param data
 * @returns {*}
 */
export function add(data) {
  return request({
    url: '/knowledge/books',
    method: 'post',
    data: data
  })
}

/**
 * 修改教材
  * @param data
 * @returns {*}
 */
export function update(data) {
  return request({
    url: '/knowledge/books',
    method: 'put',
    data: data
  })
}



/**
 * 删除教材
 * @param id
 * @returns {*}
 */
export function remove(id) {
  return request({
    url: '/knowledge/books/' + id,
    method: 'delete'
  })
}

/**
 * 导出教材
  * @param query
 * @returns {*}
 */
export function exportData(query) {
  return request({
    url: '/knowledge/books/export',
    method: 'get',
    params: query
  })
}

/**
 * 查询教材已删除数据
 * @param query
 * @returns {*}
 */
export function findDeletedList(query) {
	return request({
		url: '/knowledge/books/deleted' ,
		method: 'get',
		params: query
	})
}


/**
 * 从回收站恢复
 * @param
 * @returns {*}
 */
export function restore(id) {
	return request({
		url: '/knowledge/books/' + id + '/restore',
		method: 'put'
	})
}

